<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>自选商户开通</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<style>
		.blue:HOVER{cursor:pointer; }
	</style>
    <script type="text/javascript">
    function checkSubmit(){
    	$("#queryPerfectBillList").attr("disabled",true);
		$("#queryPerfectBillList").attr("action","<%=basePath%>/perfectBill/queryJumpMchtList.ct");
		$("#queryPerfectBillList").submit();
		
	}
    
    <%-- function checkSet(){
    	var dd = $("input[name=multi_sel]:checked");
    	var mchtCd = dd.val();
    	if(dd.length == 0){
			alert("请选择商户");
			return false;
		}else if(dd.length > 1){
			alert("最多只能领取1个商户！");
			return false;
		}else{
			$("#queryPerfectBillList").attr("disabled",true);
			window.location.href="<%=basePath%>/perfectBill/addOrUpdateJspInit.ct?mchtCode="+mchtCd;
		}
    } --%>
    
    function updStaus(mchtCd,status){
    	var str = "状态值错误";
    	
    	if(status==0 || status==""){
    		str="确定要开启商户"+mchtCd+"的自选商户开通功能吗？";
    	}else if(status==1){
    		str="确定要关闭商户"+mchtCd+"的自选商户开通功能吗？";
    	}else{
    		return; 
    	}
    	
    	if(confirm(str)){
    		$.ajax({
    			type:"post",
    			url:"openOrClosePerfectBill.ct",
    			data:{"openMchtCd":mchtCd,"openStatus":status},
    			dataType:"json",
    			success:function(result){
    				alert(result.resMap.msg);
    				window.location.href="<%=basePath%>/perfectBill/queryJumpMchtList.ct";
    			},error:function(){
    				
    			}
    			
    		});
    	}
    }
    
    
	</script>
</head>
<body>
<s:form id="queryPerfectBillList" action="" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="5"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="5"><div class="tb-h3">自选商户开通</div></td>
        </tr>

        <tr class="tb-line">
        	
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="mchtCd" name="searchCondition.mchtCd" cssClass="queryWidth" /></label>
            </td>
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">法人身份证：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="certifNo" name="searchCondition.certifNo" cssClass="queryWidth" /></label>
            </td>
         </tr>
         
         <tr class="tb-line">
        	
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">结算账号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="account" name="searchCondition.account" cssClass="queryWidth" /></label>
            </td>
            
         </tr>

        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input type="button" value="查   询" onclick="return checkSubmit();"/>
                </label>
                
            </td>
        </tr>
        <tr class="tb-line">
				<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
					<span style="color: red;"><s:actionmessage /></span> <span
					style="color: red;"><s:fielderror cssClass="fieldError" /></span>
					<span id="otherError"></span></td>
		</tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging"  align="left" colspan="4"> <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/perfectBill/queryJumpMchtList.ct?currentPage=" />

						</td>
					</tr>
	</s:if>
    </tbody>
    
</table>

<div class="big-tb">

    <table class="tb" style="width: 100%;">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="10">自选商户开通列表</th>
            </tr>
            <tr class="tb-line bg-gray">
            			<!-- <th class="tb-th">选择</th> -->
                		<th class="tb-th">商户号</th>
                		<th class="tb-th">商户简称</th>
                		<th class="tb-th">业务联系人</th>
                		<th class="tb-th">手机号</th>
                		<th class="tb-th">法人身份证</th>
                		<th class="tb-th">法人身份证号码</th>
                		<th class="tb-th">结算卡号</th>
                		<th class="tb-th">启用状态</th>
                		<!-- <th class="tb-th">功能开关</th> -->
                		<th class="tb-th">修改时间</th>
                		<s:if test="#session.session_merchant.roleType=='03' || #session.session_merchant.roleType=='02' ">
                		<th class="tb-th">操作</th>
                		</s:if>
            </tr>
        </thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="mt">
						<tr class="tb-line">
							<%-- <td align="center" class="tb-td">
								<input   name="multi_sel" value="<s:property value="#mt.mchtCd"/>" type="checkbox" />
			        		</td> --%>
							<td class="tb-td"><s:property value="#mt.mchtCd" /></td>
							<td class="tb-td"><s:property value="#mt.merName" /></td>
							<td class="tb-td"><s:property value="#mt.contactName" /></td>
							<td class="tb-td"><s:property value="#mt.contactPho" /></td>
							<td class="tb-td"><s:property value="#mt.certif" /></td>
							<td class="tb-td"><s:property value="#mt.certifNo" /></td>
							<td class="tb-td"><s:property value="#mt.account" /></td>
							<td class="tb-td">
								<s:if test="#mt.status ==\"1\"">
									<b><font color="green"><s:property value="#mt.statusName" /></font></b>
								</s:if>
								<s:elseif test="#mt.status ==\"0\"  && #mt.mccGroup!=''  ">
									<b><font color="red"><s:property value="#mt.statusName" /></font></b>
								</s:elseif>
								<s:else>
									<b><font color="blue"><s:property value="#mt.statusName" /></font></b>
								</s:else>
							</td>
							<%-- <td class="tb-td">
								<s:if test="#mt.remark1Name ==\"开启\"">
								<b><font color="green"><s:property value="#mt.remark1Name" /></font></b>
								</s:if>
								<s:else>
									<b><font color="red"><s:property value="#mt.remark1Name" /></font></b>
								</s:else>
							</td> --%>
							<td class="tb-td"><s:property value="#mt.recTm" /></td>
                		<s:if test="#session.session_merchant.roleType=='03' || #session.session_merchant.roleType=='02' ">
							<td class="tb-td">
								<s:if test="#mt.status == 0 || #mt.status=='' "><a onclick="updStaus(${mt.mchtCd},'${mt.status}' )" class="blue"><b><font color="green">开启</font></b></a></s:if>
								<s:if test="#mt.status == 1"><a onclick="updStaus(${mt.mchtCd},${mt.status} )" class="blue"><b><font color="red">关闭</font></b></a></s:if>
							</td>
							</s:if>
						</tr>
					</s:iterator>
				</tbody>
			</table>
</div>
</s:form>

<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>